﻿@{
    ViewData["Title"] = "Edit";
    
     Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>layui在线调试</title>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
     <form class="layui-form" action="/Line/UpdateFieId" lay-filter="example">
  <div class="layui-form-item">
    <label class="layui-form-label">路线名称：</label>
    <div class="layui-input-block">
      <input type="text" id="Name" name="Name" lay-verify="required" placeholder="请输入路线名称" autocomplete="off" class="layui-input" style="width:60%">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">起点</label>
    <div class="layui-input-block" style="width:50%">
      <select id="Oid" name="Oid" lay-verify="required" style="width:60%">
        <option value="0">请选择</option>
        <option value="1">上海</option>
        <option value="2">广州</option>
        <option value="3">深圳</option>
        <option value="4">杭州</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">起点详细地址:</label>
    <div class="layui-input-block">
      <input type="text" id="Ldetail" name="Ldetail" lay-verify="required" placeholder="请输入起点详细地址" autocomplete="off" class="layui-input" style="width:60%">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">终点：</label>
    <div class="layui-input-block" style="width:50%">
      <select id="Did" name="Did" lay-verify="required" style="width:60%">
        <option value="0">请选择</option>
        <option value="1">山西</option>
        <option value="2">北京</option>
        <option value="3">江苏</option>
        <option value="4">上海</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">起点详细地址:</label>
    <div class="layui-input-block">
      <input type="text" id="Ldestination" name="Ldestination" lay-verify="required" placeholder="请输入起点详细地址" autocomplete="off" class="layui-input" style="width:60%">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">是否外协：</label>
    <div class="layui-input-block" style="width:50%">
      <select id="Uid" name="Uid" lay-verify="required" >
        <option value=""></option>
        <option value="1">是</option>
        <option value="0">否</option>
      </select>
    </div>
  </div>
    <div class="layui-form-item">
    <label class="layui-form-label">货主姓名:</label>
    <div class="layui-input-block">
      <input type="text" id="Lshippername" name="Lshippername" lay-verify="required" placeholder="请输入货主姓名" autocomplete="off" class="layui-input" style="width:60%">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">货主手机号:</label>
    <div class="layui-input-block">
      <input type="text" id="Lownerphone" name="Lownerphone" lay-verify="required" placeholder="请输入货主手机号" autocomplete="off" class="layui-input" style="width:60%">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">货主单位:</label>
    <div class="layui-input-block">
      <input type="text" id="Lunit" name="Lunit" lay-verify="required" placeholder="请输入货主单位" autocomplete="off" class="layui-input" style="width:60%">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">备注:</label>
    <div class="layui-input-block">
      <input type="text" id="Lremark" name="Lremark" lay-verify="required" placeholder="请输入备注" autocomplete="off" class="layui-input" style="width:60%">
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
        <input name="Id" type="text" hidden/>
        <input name="DesId" type="text" hidden/>
      <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary" >重置</button>
     <a class="layui-btn layui-btn-primary" onclick="location.href='/Line/Index'">返回</a>
    </div>
  </div>
</form>
    <script src="~/libs/jquery/jquery.js"></script>
    <script src="~/layui/layui.js" charset="utf-8"></script>

    <script>
        layui.use(['form', 'layedit', 'laydate','upload'], function(){
          var form = layui.form
          ,layer = layui.layer
          ,layedit = layui.layedit
          ,laydate = layui.laydate
          ,upload = layui.upload
          ,element = layui.element;

          //日期
          laydate.render({
            elem: '#SigningDate'
          });
          form.render();
          //监听提交
          form.on('submit(demo1)', function(data){
          });
          //指定允许上传的文件类型
          //upload.render({
          //  elem: '#test3'
          //  ,url: '/CarryContract/FileUpload' //此处配置你自己的上传接口即可
          //  ,accept: 'file' //普通文件
          //  ,done: function(res){
          //    layer.msg('上传成功');
          //    console.log(res);
          //  }
          //});
          
        });
        $(function(){
            Edit();
            renderTime();
        })
         function renderTime(date) {
        var dateee = new Date(date).toJSON();
        return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
    }

        function Edit(){
            $.ajax({
                url:"/Line/GetCarryById?Id="+@ViewBag.Id,
                type:"get",
                dataType:"json",
                success:function(obj){
                    $("[name=Id]").val(obj.id);
                    $("[name=DesId]").val(obj.dsId);
                    $("[name=Name]").val(obj.name);
                    $("[name=Oid]").val(obj.oid);
                    $("[name=Ldetail]").val(obj.ldetail);
                    $("[name=Did]").val(obj.did);
                    $("[name=Ldestination]").val(obj.ldestination);
                    $("[name=Uid]").val(obj.uid);
                    $("[name=Lshippername]").val(obj.lshippername);
                    $("[name=Lownerphone]").val(obj.lownerphone);
                    $("[name=Lunit]").val(obj.lunit);
                    $("[name=Lremark]").val(obj.lremark);
                    $("[name=Ldate]").val(obj.ldate);
                    //console.log($("[name=Id]").val());
                }
            })
        }
    </script>
</body>
</html>



